****Title   - Jihadist terrorist attacks and far right party preferences: An `unexpected event during survey design' in four European countries
****Date    - November 2023
****Authors - Tim Vlandas and Daphne Halikiopoulou
****Journal - Perspective on Politics
****Notes   - Original data downloaded from ESS website on 19 May 2023: Netherlands (wave 2), Sweden (wave 5), France (wave 7), Germany (wave 8)

**open replication dataset
use "replication_data_20.11.23.dta"

**Figure 1
set scheme sj, permanently
twoway histogram edate if cntry=="DE", color(black%30) percent discrete xline(20) xlabel(#30, labels labsize(vsmall) angle(vertical) grid) xtitle(Date of interview) title(Germany)
graph save histogramGermany
histogram edate if cntry=="FR", color(black%30) percent discrete xline(20) xlabel(#30, labels labsize(vsmall) angle(vertical) grid) xtitle(Date of interview) title(France) 
graph save histogramFrance
histogram edate if cntry=="NL", color(black%30) percent discrete xline(20) xlabel(#30, labels labsize(vsmall) angle(vertical) grid) xtitle(Date of interview) title(Netherlands) 
graph save histogramNetherlands
histogram edate if cntry=="SE", color(black%30) percent discrete xline(20) xlabel(#30, labels labsize(vsmall) angle(vertical) grid) xtitle(Date of interview) title(Sweden)
graph save  histogramSweden
graph combine histogramFrance.gph histogramGermany.gph histogramNetherlands.gph histogramSweden.gph, ycommon
*note that the vertical lines showing the timing of terrorist attacks were added manually to each histogram: 19 December 2016 in Germany; 7 January 2015 in France; 2 November 2004 in the Netherlands; and 11 December 2010 in Sweden.

**Figure 2: this figure plots the mean (and 95% confidence interval around the mean) for each variable in the control and treatment group respectively. The data is shown in Table A1.3 in appendix using the following commands:
ttest Unemployed, by(Treatment)
ttest Female, by(Treatment)
ttest Child, by(Treatment)
ttest Age, by(Treatment)
ttest Education, by(Treatment)
ttest Income, by(Treatment)
ttest Religiosity, by(Treatment)
ttest Authority, by(Treatment)
ttest Culture, by(Treatment)
ttest Farright, by(Treatment)

**Table 3
ebalance Treatment Unemployed Female Child Age Education Income Religiosity Authority Culture  id
reg Farright Treatment  i.id [pweight=dweight], vce(robust)
outreg2 using table3, excel replace
reg Farright Treatment Age Female  i.id [pweight=dweight], vce(robust)
outreg2 using table3, excel append
reg Farright Treatment Age Female Child   i.id [pweight=dweight], vce(robust)
outreg2 using table3, excel append
reg Farright Treatment Age Female Child  Domicile   i.id [pweight=dweight], vce(robust)
outreg2 using table3, excel append
reg Farright Treatment Age Female Child  Domicile  Education  i.id [pweight=dweight], vce(robust)
outreg2 using table3, excel append
reg Farright Treatment Age Female Child  Domicile  Education  Income  i.id [pweight=dweight], vce(robust)
outreg2 using table3, excel append
reg Farright Treatment Age Female Child  Domicile  Education  Income Unemployed i.id [pweight=dweight], vce(robust)
outreg2 using table3, excel append
reg Farright Treatment Age Female Child  Domicile  Education  Income Unemployed Religiosity   i.id [pweight=dweight], vce(robust)
outreg2 using table3, excel append
reg Farright Treatment Age Female Child  Domicile  Education  Income Unemployed Religiosity Authority  i.id [pweight=dweight], vce(robust)
outreg2 using table3, excel append
reg Farright Treatment Age Female Child  Domicile  Education  Income Unemployed Religiosity Authority Culture i.id [pweight=dweight], vce(robust)
outreg2 using table3, excel append
reg Farright Treatment Age Female Child  Domicile  Education  Income Unemployed Religiosity Authority Culture i.id [pweight=_webal*dweight], vce(robust)
outreg2 using table3, excel append

**Table 5
ebalance Treatment Unemployed Female Child Age Education Income Religiosity Authority Culture  id
reg Culture  Treatment Age Female Child  Domicile  Education  Income Unemployed Religiosity  i.id [pweight=dweight], vce(robust)
outreg2 using table5, excel replace
reg Immigration_overall Treatment Age Female Child  Domicile  Education  Income Unemployed Religiosity  i.id [pweight=dweight], vce(robust)
outreg2 using table5, excel append
reg Antirefugee  Treatment Age Female Child  Domicile  Education  Income Unemployed Religiosity   i.id [pweight=dweight], vce(robust)
outreg2 using table5, excel append

**Table 6
ebalance Treatment Unemployed Female Child Age Education Income Religiosity Authority Culture  id
reg Politicians    Treatment Age Female Child  Domicile  Education  Income Unemployed Religiosity   i.id [pweight=dweight], vce(robust)
outreg2 using table6, excel replace
reg Parties    Treatment Age Female Child  Domicile  Education  Income Unemployed Religiosity   i.id [pweight=dweight], vce(robust)
outreg2 using table6, excel append
reg Legislative   Treatment Age Female Child  Domicile  Education  Income Unemployed Religiosity   i.id [pweight=dweight], vce(robust)
outreg2 using table6, excel append
reg Satisfied  Treatment Age Female Child  Domicile  Education  Income Unemployed Religiosity   i.id [pweight=dweight], vce(robust)
outreg2 using table6, excel append